<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户管理 - 若依语音通话系统</title>
    <link th:href="@{/css/style.css}" rel="stylesheet">
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>用户管理</h1>
            <div class="header-actions">
                <a th:href="@{/user/add}" class="btn btn-primary">添加用户</a>
                <a th:href="@{/logout}" class="btn btn-secondary">退出登录</a>
            </div>
        </div>
        
        <div class="content">
            <table class="table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>用户名</th>
                        <th>昵称</th>
                        <th>邮箱</th>
                        <th>电话</th>
                        <th>状态</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr th:each="user : ${users}">
                        <td th:text="${user.id}"></td>
                        <td th:text="${user.username}"></td>
                        <td th:text="${user.nickname}"></td>
                        <td th:text="${user.email}"></td>
                        <td th:text="${user.phone}"></td>
                        <td th:text="${user.status == 1 ? '启用' : '禁用'}"></td>
                        <td th:text="${user.createTime}"></td>
                        <td>
                            <a th:href="@{/user/edit/{id}(id=${user.id})}" class="btn btn-small btn-info">编辑</a>
                            <a th:href="@{/user/delete/{id}(id=${user.id})}" class="btn btn-small btn-danger" onclick="return confirm('确定要删除该用户吗？')">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <script th:src="@{/js/main.js}"></script>
</body>
</html>